package com.fengye.common;

import org.apache.commons.lang.time.FastDateFormat;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 通用工具类
 *
 * @Author fengye
 * @Date 2023/2/13 9:10
 **/
public class CommonUtil {

    public final static String PATTERN =  "yyyy-MM-dd HH:mm:ss";
    public final static SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(PATTERN);

    public static final FastDateFormat FAST_DATE_FORMAT = FastDateFormat.getInstance(PATTERN);

    public final static DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormat.forPattern(PATTERN);

    public static String simpleFormatDate(Date date) {
        return SIMPLE_DATE_FORMAT.format(date);
    }

    public static String fastDateFormat(Date date) { return FAST_DATE_FORMAT.format(date); }
}
